#ifndef prs_FrmButtonStyle_H
#define prs_FrmButtonStyle_H

#include "prs_FrmFunc.h"
#include "prs_FrmRules.h"
#include "prs_FrmStyleState.h"
#include "frm_control_TButton.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmButtonStyle : public TNodeStyleControl
{
  DECLARE_ClientNode()
  TAttrNodeType<nodeType_Button> NodeType;
  TAttrObject<nodeType_Style,frm::control::TButton::TStyle> Style;
  //
  TNodeFrmButtonStyle() : NodeType(this),Style(this) { Style.Value.EnTimer = false;}
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmButtonStyle : public snt::TRule
{
  TRuleFrmButtonStyle(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmStyleState &RStyleState
  );
  
private:  
  TNodeFrmButtonStyle *GetNode() { return dynamic_cast<TNodeFrmButtonStyle*>(vParentNode.Pointer());}
  //
  void FNormal (snt::TParams &Params) { rStyleState.SetState( &GetNode()->Style.Value.Normal );}
  void FDown   (snt::TParams &Params) { rStyleState.SetState( &GetNode()->Style.Value.Down );}
  void FFlat   (snt::TParams &Params) { rStyleState.SetState( &GetNode()->Style.Value.Flat );}
  void FDisable(snt::TParams &Params) { rStyleState.SetState( &GetNode()->Style.Value.Disable );}
  void FEnTimer(snt::TParams &Params) { GetNode()->Style.Value.EnTimer = true; }
  //
  svl::TVariant &vParentNode;
  snt::TAlter A, AB;
  TRuleFrmStyleState &rStyleState;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
